package com.mc.read.pcApi.controller;

import com.mc.read.pcApi.service.LoginService;
import com.mc.read.vo.request.BaseRequest;
import com.mc.read.vo.respose.BaseRespose;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Author:LiuHao
 * @Date:14:30 2019/5/30
 * 登录
 **/
@Controller
@RequestMapping(value = "login/")
@Slf4j
public class LoginController {
    @Autowired
    LoginService loginService;

    /**
     * @Author:LiuHao
     * @Date:14:31 2019/5/30
     * 登录login
     **/
    @ResponseBody
    @RequestMapping(value = "login", method = RequestMethod.POST)
    public BaseRespose login(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = loginService.login(baseRequest);
        return baseRespose;
    }

    /**
     * @Author:LiuHao
     * @Date:16:50 2019/5/30
     * 发送登录验证码 sendLoginCode
     **/
    @ResponseBody
    @RequestMapping(value = "sendLoginCode", method = RequestMethod.POST)
    public BaseRespose sendLoginCode(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = loginService.sendLoginCode(baseRequest);
        return baseRespose;
    }

   /**
    * @Author:LiuHao
    * @Date:12:02 2019/7/3
    *查询是否登录了 selectIsLogin
    **/
   @ResponseBody
   @RequestMapping(value = "selectIsLogin", method = RequestMethod.POST)
   public BaseRespose selectIsLogin(@RequestBody BaseRequest baseRequest) {
        BaseRespose baseRespose = loginService.selectIsLogin(baseRequest);
        return baseRespose;
    }


}
